<#assign basePath=request.contextPath />
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>个人资料修改</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link href="${basePath}/js/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
    <script src="${basePath}/js/jquery1.8.3.min.js"></script>
    <script src="${basePath}/js/layer/layer.js"></script>
    <script src="${basePath}/js/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script src="${basePath}/js/shiro.demo.js"></script>
</head>
<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-12">
            <div class="col-md-10" style="margin-top: 1.5em">
                <form id="formId" enctype="multipart/form-data" action="${basePath}/user/updateSelf" method="post">
                    <input type="hidden" value="${currentUser.id}" name="id"/>
                    <div class="form-group">
                        <label for="nickname">昵称</label>
                        <input type="text" class="form-control" autocomplete="off" id="nickname" maxlength="8" name="nickname" value="${currentUser.nickname?default('未设置')}" placeholder="请输入昵称">
                    </div>
                    <div class="form-group">
                        <label for="email">Email（不准修改）</label>
                        <input type="text" class="form-control " disabled autocomplete="off" id="email" maxlength="64" name="email" value="${currentUser.email?default('未设置')}" placeholder="请输入帐号">
                    </div>
                    <div class="form-group">
                        <button type="submit" class="btn btn-success">确定修改</button>
                    </div>
                </form>

            </div>
        <#--地图
       <@_html.tool_map/>
       -->
        </div><#--/row-->
    </div>
<#-- 页脚
<@_footer.footer 0/>
-->
    <script src="${basePath}/js/common/jquery/jquery.form-2.82.js"></script>
    <script>
        $(function(){
            var load;
            $("#formId").ajaxForm({
                success:function (result){
                    layer.close(load);
                    if(result && result.status == 300){
                        layer.msg(result.message,function(){});
                        return !1;
                    }
                    if(result && result.status == 500){
                        layer.msg("操作失败！",function(){});
                        return !1;
                    }
                    layer.msg('操作成功！');
                },
                beforeSubmit:function(){
                    //判断参数
                    if($.trim($("#nickname").val()) == ''){
                        layer.msg('昵称不能为空！',function(){});
                        $("#nickname").parent().removeClass('has-success').addClass('has-error');
                        return !1;
                    }else{
                        $("#nickname").parent().removeClass('has-error').addClass('has-success');
                    }
                    load = layer.load();
                },
                dataType:"json",
                clearForm:false
            });

        });
    </script>

</body>
</html>